import os
import configs
from template.singleton import Singleton


class Speak:
    def param(self, rate=0.15, pitch=-0.04) -> None:
        """Setter изменнения парметров синтезатора речи

        Праметры:
        `rate`: rate
        `pitch`: pitch
        """
        configs.rate = rate
        configs.pitch = pitch

    def speak(self, _say, lang: str = "defult"):
        # os.system(
        #            f"echo {_say} |RHVoice-test -s {configs.dict_value_str_voice['voice_name']} --rate {configs.rate} --pitch {configs.pitch} | aplay"
        #        )
        # echo "Привет" |RHVoice-client -s Anna  --rate 0,2 --pitch 0,05 | aplay
        # echo "Проверка синтезатора речи" | spd-say -o rhvoice -l ru -e -t
        # female1
        os.system(f"echo {_say} | spd-say -o rhvoice -l ru -e -t female1")

    def kill(self) -> None:
        os.system("pkill -9 RHVoice-client")
